package com.araaya.eslimsmobile;


import com.araaya.eslimsmobile.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class WebSiteCaller extends Activity {

	WebView webView;

	@Override
	public void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		setContentView(R.layout.web_home);
		webView = (WebView) findViewById(R.id.webview);
		WebSettings webSettings = webView.getSettings();
		webSettings.setJavaScriptEnabled(true);
		
		
		String webSiteUrl = getIntent().getExtras().getString("webAddress");
		// Setting WebChromeClient to webView
		//webView.setWebChromeClient(new WebChromeClient());
		webView.setWebChromeClient(new WebChromeClient());
		// webView.loadUrl(ElandConstant.MAIN_SITE_URL);
				
		webView.loadUrl(webSiteUrl);
		finish();
		
		
		
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (event.getAction() == KeyEvent.ACTION_DOWN) {
			switch (keyCode) {
			case KeyEvent.KEYCODE_BACK:
				if (webView.canGoBack() == true) {
					webView.goBack();
				} else {
					finish();
				}
				finish();
				return true;
			}

		}
		return super.onKeyDown(keyCode, event);
	}

	
	
	  /*@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
	  
	  if ((keyCode == KeyEvent.KEYCODE_BACK) && webView.canGoBack()) {
	  Log.d("WEB===>", "Back Call...."); //webView.clearCache(true);
	 //webView.clearHistory(); finish(); }
	 
	return super.onKeyDown(keyCode, event); }*/
	 
	
	

}


